-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Add LDAP AuthenticationManager factory #10138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add LDAP AuthenticationManager factory #10138
Conversation
6267fcc to
47cea15
Compare
47cea15 to
a71759f
Compare
rwinch
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates. I've provided feedback inline.
ldap/src/main/java/org/springframework/security/ldap/server/EmbeddedLdapServerContainer.java
Outdated
Show resolved
Hide resolved
a71759f to
e418a71
Compare
...main/java/org/springframework/security/config/ldap/LdapAuthenticationManagerFactoryBean.java
Outdated
Show resolved
Hide resolved
config/src/main/java/org/springframework/security/config/ldap/LdapContextSourceFactoryBean.java
Outdated
Show resolved
Hide resolved
...ava/org/springframework/security/config/ldap/EmbeddedLdapServerContextSourceFactoryBean.java
Show resolved
Hide resolved
e418a71 to
048c782
Compare
|
Updated example usage: @Bean
public EmbeddedLdapServerContextSourceFactoryBean contextSourceFactoryBean() {
EmbeddedLdapServerContextSourceFactoryBean contextSourceFactoryBean =
EmbeddedLdapServerContextSourceFactoryBean.fromEmbeddedLdapServer();
contextSourceFactoryBean.setPort(0);
return contextSourceFactoryBean;
}
@Bean
public AuthenticationManager authenticationManager(BaseLdapPathContextSource contextSource) {
LdapAuthenticationManagerFactory factory = LdapAuthenticationManagerFactory
.usingBindAuthentication(contextSource);
factory.setUserDnPatterns("uid={0},ou=people");
factory.setUserDetailsContextMapper(new PersonContextMapper());
return factory.createAuthenticationManager();
} |
rwinch
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates. I've commented inline
...src/main/java/org/springframework/security/config/ldap/LdapAuthenticationManagerFactory.java
Outdated
Show resolved
Hide resolved
...src/main/java/org/springframework/security/config/ldap/LdapAuthenticationManagerFactory.java
Outdated
Show resolved
Hide resolved
048c782 to
00d8e7a
Compare
00d8e7a to
bee8f20
Compare
rwinch
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! It looks good to me 👍
|
Updated example configuration: Note: the issue description has also been updated to the latest configuration. |
bee8f20 to
ad33eae
Compare
ad33eae to
11ed970
Compare
This PR introduces a
LdapBindAuthenticationManagerFactory,LdapPasswordComparisonAuthenticationManagerFactoryandEmbeddedLdapServerContextSourceFactoryBeanwhich can be used to create anAuthenticationManagerthat can perform LDAP authentication.This is an example usage
It is equivalent to the following configuration
Logs and reference documentation will be added in future commits.